package com.eolcum.evo.persistence;

import java.util.List;


//import javax.xml.bind.annotation.XmlElement;

public class Apartment {

	private int id;
	private String name;
	private List<Room> rooms;

	/**
	 * @return the rooms
	 */
	public synchronized List<Room> getRooms() {
		return rooms;
	}

	/**
	 * @param rooms
	 *            the rooms to set
	 */
//	@XmlElement(required = true, name = "ApartmentRoom")
	public synchronized void setRooms(List<Room> rooms) {
		this.rooms = rooms;
	}

	/**
	 * @return the id
	 */
	public synchronized int getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
//	@XmlElement(required = true, name = "ApartmentId")
	public synchronized void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public synchronized String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
//	@XmlElement(required = true, name = "ApartmentName")
	public synchronized void setName(String name) {
		this.name = name;
	}

	public Room getRoom(int roomId) {
		for(int i = 0; i < rooms.size(); i++) {
			if(rooms.get(i).getId() == roomId) {
				return rooms.get(i);
			}
		}
		return null;
	}
}
